package com.woniu.idearbac.Service.impl;

import com.woniu.idearbac.Service.RolesService;
import com.woniu.idearbac.dto.RolesDTO;
import com.woniu.idearbac.entity.SysRole;
import com.woniu.idearbac.mapper.SysRoleMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 功能描述
 *
 * @author PC
 * @date -2022/11/30-时间-13:25
 * @product idea-rbac
 */
@Service
public class RolesServiceImpl implements RolesService {
    @Resource
    private SysRoleMapper sysRoleMapper;

    @Override
    public List<String> selectRolesByTel(String tel) {
        return sysRoleMapper.selectRolesByTel(tel);
    }

    @Override
    @Transactional
    public int insertRoles(RolesDTO rolesDTO) {
        sysRoleMapper.delByBid(rolesDTO.getUid());
        return sysRoleMapper.insertRoles(rolesDTO);
    }


    @Override
    public List<SysRole> selAll() {
        return sysRoleMapper.selAll();
    }

    @Override
    public List<Integer> selRolesByUid(Long uid) {
        return sysRoleMapper.selRolesByUid(uid);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return sysRoleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(SysRole record) {
        return sysRoleMapper.insertSelective(record);
    }

    @Override
    public SysRole selectByPrimaryKey(Long id) {
        return sysRoleMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SysRole record) {
        return sysRoleMapper.updateByPrimaryKeySelective(record);
    }
}
